<template>
	<div>
		<!-- 内容 -->
		<transition name="fade" mode="out-in" appear>
			<el-row>
				<el-col :span="12">
					<h3>会员基本信息</h3>
					<table border="1">
						<tr>
							<th>属性</th>
							<th>详情</th>
						</tr>
						<tr v-for="item in formUsersText">
							<td>{{item.text}}</td>
							<td>{{formUsers[item.field]}}</td>
						</tr>
					</table>
				</el-col>
				<el-col :span="12">
					<h3>相关证件</h3>
					<h4>身份证证件</h4>
					<img :src="formUsers.identity_img_front" alt="" />
					<img :src="formUsers.identity_img_contrary" alt="" />
					
					<h4>营业执照附件</h4>
					<img :src="formUsers.permit" alt="" />
				</el-col>
			</el-row>
		</transition>
	</div>
</template>

<script>
	import http from 'assets/js/http.js'

	export default {
		components: {},
		data() {
			return {
				config: {},
				id: '',
				formUsers: {},
				formCars: [],
				value: [],
				formUsersText: [{
						text: '商户名称',
						field: 'name',
					},
					{
						text: '地域',
						field: 'address',
					},
					{
						text: '商户地址',
						field: 'address',
					},
					{
						text: '店铺图标',
						field: 'logo',
					},
					{
						text: '营业时间',
						field: 'start_hours',
					},
					{
						text: '经营者姓名',
						field: 'user_name',
					},
					{
						text: '电话',
						field: 'contact_number',
					},
					{
						text: '身份证号',
						field: 'identity_number',
					},
					{
						text: '营业执照类型',
						field: 'type',
					},
					{
						text: '注册号',
						field: 'regist_code',
					},
					{
						text: '店铺类型',
						field: 'company_sort_name',
					},
				],
				formCarsText: [{
						text: '车主姓名',
						field: 'name',
					},
					{
						text: '车型车号',
						field: 'vehicle_type',
					},
					{
						text: '车牌号码',
						field: 'number',
					},
					{
						text: '身份证号',
						field: 'identity',
					},
					{
						text: '爱车品牌',
						field: 'vehicle_brand',
					}
				],
				formAccountText: [{
						text: '用户账号',
						field: 'username',
					},
					{
						text: '密码',
						field: 'vehicle_type',
					}
				]

			}
		},
		created() {
			this.id = this.$route.params.id
			console.log('this.id', this.id)
			const data = {
				'id': this.id
			}
			this.$watch('$route', {
				deep: true,
				handler: function() {
					this.id = this.$route.params.id
					this.apiPost('AdminApi/shop/company_deta', data).then(res => {
						console.log('res', res)
						this.handelResponse(res, data => {
							this.formUsers = data[0]
						})
					})
				}
			})
			this.apiPost('AdminApi/shop/company_deta', data).then(res => {
				console.log('res', res)
				this.handelResponse(res, data => {
					this.formUsers = data[0]
				})
			})

		},
		methods: {

		},
		mixins: [http]
	}
</script>

<style scoped>
	table {
		border-collapse: collapse;
		/*关键代码*/
	}
</style>